home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / bbs_util / bsrc_260.zip / SRC.ZIP / DATA.C < prev    next >
C/C++ Source or Header  |  1996-03-26  |  31KB  |  956 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*              (C) Copyright 1987-96, Bit Bucket Software Co.              */
  11. /*                                                                          */
  12. /*            This module was originally written by Bob Hartman             */
  13. /*                                                                          */
  14. /*                            BinkleyTerm Data                              */
  15. /*                                                                          */
  16. /*                                                                          */
  17. /*    For complete  details  of the licensing restrictions, please refer    */
  18. /*    to the License  agreement,  which  is published in its entirety in    */
  19. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.260.    */
  20. /*                                                                          */
  21. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  22. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  23. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  24. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  25. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  26. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  27. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  28. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  29. /*                                                                          */
  30. /*                                                                          */
  31. /* You can contact Bit Bucket Software Co. at any one of the following      */
  32. /* addresses:                                                               */
  33. /*                                                                          */
  34. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             */
  35. /* P.O. Box 460398                AlterNet 7:42/1491                        */
  36. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  37. /*                                Internet f491.n343.z1.fidonet.org         */
  38. /*                                                                          */
  39. /* Please feel free to contact us at any time to share your comments about  */
  40. /* our software and/or licensing policies.                                  */
  41. /*                                                                          */
  42. /*--------------------------------------------------------------------------*/
  43.  
  44. /* Include this file before any other includes or defines! */
  45.  
  46. #include "includes.h"
  47.  
  48. unsigned int BINK_MAJVERSION = PRDCT_MAJOR;
  49. unsigned int BINK_MINVERSION = PRDCT_MINOR;
  50.  
  51. #ifdef PRIVATE_IDAHO
  52. #define ALPHA_DATE      ""
  53. #else
  54. #define ALPHA_DATE      ""
  55. #endif
  56.  
  57. #ifdef DOS16
  58. char *ANNOUNCE = PRDCT_PRTY " Version " PRDCT_VRSN ALPHA_DATE;
  59. char *xfer_id = PRD_SH_PRTY " " PRDCT_VRSN;
  60. #endif
  61.  
  62. #ifdef OS_2
  63. char *ANNOUNCE = "BinkleyTerm-OS/2 Ver. " PRDCT_VRSN ALPHA_DATE;
  64. char *xfer_id = "BinkOS2 " PRDCT_VRSN;
  65. #endif
  66.  
  67. #ifdef _WIN32
  68. char *ANNOUNCE = "BinkleyTerm/Win32 Ver. " PRDCT_VRSN ALPHA_DATE;
  69. char *xfer_id = "BinkW32 " PRDCT_VRSN;
  70. #endif
  71.  
  72. short SB_COLS_M_1 = 0;
  73.  
  74. short SB_ROW_HOLD = 6;
  75. short SB_ROW_STATUS = 0;
  76. short SB_ROWS_M_1 = 0;
  77. short SB_ROWS_M_2 = 0;
  78. short SB_ROWS_M_15 = 0;
  79.  
  80. struct _key_fnc_hdr TrmnlKeyFncHdr;
  81. struct _key_fnc_hdr UnattendedKeyFncHdr;
  82.  
  83. char **msgtxt;
  84. struct _lang_hdr *LangHdr = NULL;
  85.  
  86. char *mtext[] =
  87. {
  88.     "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  89.     "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
  90. };
  91.  
  92. struct baud_str btypes[] =
  93. {
  94. #ifdef BAUD_150
  95.     {150, BAUD_150},
  96. #endif
  97.     {300, BAUD_300},
  98. #ifdef BAUD_600
  99.     {600, BAUD_600},
  100. #endif
  101.     {1200, BAUD_1200},
  102.     {2400, BAUD_2400},
  103.     {4800, BAUD_4800},
  104.     {9600, BAUD_9600},
  105.     {19200, BAUD_19200},
  106.     {38400, BAUD_38400},
  107. #ifdef BAUD_57600
  108.     {57600, BAUD_57600},
  109. #endif
  110. #ifdef BAUD_115200
  111.     {115200, BAUD_115200},
  112. #endif
  113.     {0, 0}
  114. };
  115.  
  116. #ifdef EXTENDED_BAUDRATES
  117.  
  118. int extend_rates = 0;
  119.  
  120. struct baud_str exttypes[] =
  121. {
  122. #ifdef BAUD_EXT_150
  123.     {150, BAUD_EXT_150},
  124. #endif
  125. #ifdef BAUD_EXT_300
  126.     {300, BAUD_EXT_300},
  127. #endif
  128. #ifdef BAUD_EXT_600
  129.     {600, BAUD_EXT_600},
  130. #endif
  131. #ifdef BAUD_EXT_1200
  132.     {1200, BAUD_EXT_1200},
  133. #endif
  134. #ifdef BAUD_EXT_2400
  135.     {2400, BAUD_EXT_2400},
  136. #endif
  137. #ifdef BAUD_EXT_4800
  138.     {4800, BAUD_EXT_4800},
  139. #endif
  140. #ifdef BAUD_EXT_9600
  141.     {9600, BAUD_EXT_9600},
  142. #endif
  143. #ifdef BAUD_EXT_19200
  144.     {19200, BAUD_EXT_19200},
  145. #endif
  146. #ifdef BAUD_EXT_38400
  147.     {38400, BAUD_EXT_38400},
  148. #endif
  149. #ifdef BAUD_EXT_57600
  150.     {57600, BAUD_EXT_57600},
  151. #endif
  152. #ifdef BAUD_EXT_76800
  153.     {76800, BAUD_EXT_76800},
  154. #endif
  155. #ifdef BAUD_EXT_115200
  156.     {115200, BAUD_EXT_115200},
  157. #endif
  158.     {0, 0}
  159. };
  160. #endif    /* EXTENDED_BAUDRATES */
  161.  
  162. struct baud_str max_baud = {2400, BAUD_2400};        /* Max baud value */
  163.  
  164. struct baud_str *pbtypes = btypes;
  165.  
  166. struct parse_list far DOS_commands[] =
  167. {
  168.     {7, "noforce"},
  169.     {4, "mail"},
  170.     {5, "share"},
  171.     {5, "dynam"},
  172.     {10, "unattended"},
  173.     {6, "config"},
  174.     {4, "poll"},
  175.     {0, ""}
  176. };
  177.  
  178. int locate_x, locate_y, port_ptr, original_port;
  179.  
  180. int TaskNumber = 0;                /* unique user-specified id   */
  181. int share = SHARE_DEFAULT;        /* if 1, don't uninit FOSSIL  */
  182. int no_sharing = 0;                /* if 1, no File Sharing calls*/
  183. int no_size = 0;
  184. int first_block;                /* 1 = first block/Matrix packet */
  185.  
  186. int serial = -1;                /* -1 is unregistered         */
  187. int fstblklen = 0;                /* Start Zmodem packet size   */
  188. int net_params = 0;
  189. int un_attended = 0;
  190. int command_line_un;
  191. int overwrite = 0;
  192. int redo_dynam = 0;
  193. int fullscreen = 1;
  194. int do_screen_blank = 0;
  195. int screen_blank = 0;
  196. int blank_on_key = 1;
  197. unsigned int blank_time = 6000;
  198. unsigned BBStimeout = 2000;
  199. int loglevel = 6;
  200. int debugging_log = 0;
  201. int gong_allowed = 0;
  202. int MAXport = 2;
  203. int pvtnet = -1;
  204. int poll_tries = 500;            /* How many tries in a poll? */
  205.  
  206. int ring_tries = 4;                /* How many rings before fail   */
  207. int ring_wait = 1;                /* Incoming rings before answer */
  208.  
  209. int com_port = 0;                /* Default com port = COM1   */
  210. int buftmo = 6000;                /* 60 second timeout         */
  211. unsigned int comm_bits = BITS_8;/* Default data bits = 8     */
  212. unsigned int parity = NO_PARITY;/* Default parity = NONE     */
  213. unsigned int stop_bits = STOP_1;/* Default stop bits = 1     */
  214. unsigned int carrier_mask = 0x80;    /* Default carrier bit = 80H */
  215. unsigned int handshake_mask = USE_XON | USE_CTS;    /* Force CTS/RTS flow control*/
  216.  
  217. int baud;                        /* Index to baud table       */
  218. struct baud_str cur_baud;        /* Current baud rate         */
  219. int fax_baud = -1;                /* Index of baud for faxes   */
  220.  
  221. char *modem_init = NULL;        /* Used to init modem        */
  222. char *term_init = NULL;            /* Used to init modem in terminal mode */
  223. char *modem_busy = NULL;        /* Take modem offhook        */
  224. char *modem_aftercall = NULL;    /* Send to modem after call  *//* MB 93-12-12  AFTERCALL */
  225. int lines_aftercall = 0;
  226. char *predial = NULL;            /* Pre-dial setup            */
  227. char *postdial = NULL;            /* Post-dial cleanup         */
  228. char *normprefix;
  229. char *normsuffix;
  230. char *dial_setup;
  231. char *init_setup;
  232.  
  233. char *emsistr[] =
  234. {
  235.     "**EMSI_REQA77E",
  236.     "**EMSI_DAT",
  237.     "**EMSI_HBTEAEE",
  238.     "**EMSI_NAKEEC3",
  239.     "**EMSI_ACKA490",
  240.     "**EMSI_INQC816",
  241.     "**EMSI_CLIFA8C"
  242. };
  243.  
  244. unsigned int matrix_mask = TAKE_REQ;    /* Netmail session abilities */
  245. char *system_name = NULL;        /* Name of system to send    */
  246. char *sysop = NULL;                /* Name of sysop for yoohoo  */
  247. char *location = "Somewhere";    /* Name of location for EMSI */
  248. char *myphone = "-Unpublished-";/* Own phonenumber for EMSI  */
  249. char *myflags = "";                /* Nodelistflags for EMSI    */
  250. char *mymaxbaud = "";            /* Max. baudrate for EMSI    */
  251. char *netmail = NULL;            /* Net Mail directory        */
  252. char *net_info = NULL;            /* Location of nodelist, etc */
  253. char *hold_area = NULL;            /* Path to outbound dir      */
  254. char *flag_dir = NULL;            /* Where to find INMAIL.$$$  */
  255. char *fax_in = NULL;            /* Where to store inbound fax*/
  256. char *domain_area = NULL;        /* Where to put domain name  */
  257. char *domain_loc = NULL;        /* Where to put domain name  */
  258. ADDR alias[ALIAS_CNT];            /* List of alias addresses   */
  259. int num_addrs = 0;                /* How many we're using      */
  260. int assumed = 0;                /* Alias we're now assuming  */
  261.  
  262. ADDR boss_addr;                    /* Bossnode address */
  263. ADDR my_addr;                    /* Our address      */
  264.  
  265. struct secure CURRENT;            /* Current path, quotas, etc */
  266.  
  267. struct secure DEFAULT;            /* Default paths, etc        */
  268. struct secure KNOWN;            /* Sec for KNOWN address     */
  269. struct secure PROT;                /* Sec for PW-PR address     */
  270.  
  271. struct req_accum freq_accum;    /* Accumulator for freq stats*/
  272.  
  273. char *domain_name[50];            /* Known domain names        */
  274. char *domain_abbrev[50];        /* Known domain name abbrev  */
  275. char *domain_nodelist[50];        /* Known domain nodelists    */
  276.  
  277. DOMAINKLUDGE *domainkludge;        /* Pointer to domain kludges */
  278. int num_domain_kludge = 0;        /* Number of domain kludges  */
  279. int size_domain_kludge = 0;        /* Current size of kludge    */
  280.  
  281. byte *Txbuf;                    /* Pointer to xmit buffer    */
  282. byte *Secbuf;                    /* Pointer to recv buffer    */
  283. byte *popbuf;                    /* Pointer to popup buffer   */
  284.  
  285. char *native_protocols = "XZTS";/* Protocols we support      */
  286. char *extern_protocols = NULL;    /* Protocols we can call     */
  287. char *protocols[MAX_EXTERN];    /* external file protocol    */
  288. int extern_index = 0;            /* external proto index      */
  289. struct prototable protos[MAX_EXTERN]; /* Table for execution */
  290.  
  291. char *ext_mail_string[16];        /* String for UUCP, etc.     */
  292. int lev_ext_mail[16];            /* Errorlevel for extmail    */
  293. int num_ext_mail;                /* Number of ext mails       */
  294.  
  295. char *BBSopt = NULL;            /* BBS command options       */
  296. char *BBSbanner = NULL;            /* BBS banner                */
  297. char *BBSreader = NULL;            /* Message reader            */
  298. char *BOSSphone = NULL;            /* Phone number for boss     */
  299. char *BOSSpwd = NULL;            /* Password for boss         */
  300. char *download_path = "";        /* Default download path     */
  301. char *BBSnote = NULL;            /* Tell user BBS loading     */
  302. char *MAILnote = NULL;            /* Say same for ext mail     */
  303. char *EXTopt = NULL;            /* External mailer options   */
  304.  
  305. #ifdef BINKLEY_SOUNDS
  306. char *fnBBSSound = NULL;
  307. char *fnEXTSound = NULL;
  308. char *fnMailSound = NULL;
  309. char *fnFileSound = NULL;
  310. char *fnStartSound = NULL;
  311. char *fnFAXSound = NULL;
  312. #endif
  313.  
  314. void (_cdecl * mtask_idle) (void);
  315. char *mtask_name = NULL;
  316. char *BINKpath = "";
  317. char capturename[100];
  318. char *log_name = NULL;
  319. char *config_name = PRDCT_PRFX ".Cfg";
  320. char *swapdir = NULL;
  321. char *saved_TZ = NULL;
  322.  
  323. #ifdef Snoop
  324. char pipename[80];
  325. #endif
  326.  
  327. char *scan_list[10];
  328. int set_loaded = 0;
  329.  
  330. byte user_exits[6];
  331.  
  332. char junk[256];
  333. int happy_compiler;
  334. REGIONP wholewin;
  335. REGIONP settingswin;
  336. REGIONP historywin;
  337. REGIONP holdwin;
  338. REGIONP callwin;
  339. REGIONP filewin;
  340.  
  341. int scrllines = 0;
  342.  
  343. PN_TRNS *pn = NULL;
  344. MDM_TRNS *mm = NULL;
  345.  
  346. int resp_count = 0;
  347. int max_resp_count = 0;
  348. struct resp_str *mdm_resps = NULL;
  349.  
  350. /* Default modem response strings. Used when the user
  351.    doesn't take advantage of the new config verbs. */
  352.  
  353. int def_resp_count = 15;        /* Change to match def_mdm_resps */
  354. struct resp_str def_mdm_resps[] =
  355. {
  356.     {"RINGING", IGNORE},
  357.     {"RING RESPONSE", IGNORE},
  358.     {"RING", RINGING},
  359.     {"CONNECT", CONNECTED},
  360.     {"RRING", IGNORE},
  361.     {"BUSY", DIALRETRY},        /* Was FAILURE before dial retry */
  362.     {"VOICE", FAILURE},
  363.     {"ERROR", FAILURE},
  364.     {"OK", FAILURE},
  365.     {"NO CARRIER", FAILURE},
  366.     {"NO DIAL", INCOMING},        /* "NO DIAL TONE" or "NO DIALTONE" */
  367.     {"DIALING", IGNORE},
  368.     {"NO ANSWER", FAILURE},
  369.     {"DIAL TONE", IGNORE},
  370.     {"+FCO", FAX},
  371. };
  372.  
  373. FILE *cost_log = NULL;
  374. char *cost_log_name = NULL;
  375. int cost_unit = 1;
  376. int eurocost = 0;
  377.  
  378. FILE *status_log = NULL;
  379. short boxtype = 0;
  380. int modemring = 0;                /* Modem doesn't differ for RING and RINGING */
  381. int no_collide = 0;                /* No collision detect */
  382. int cursor_col = 79;
  383. int cursor_row = 22;
  384. int leave_dtr_high = 0;
  385. char *ans_str = NULL;
  386. char *keys[9];
  387. char *shells[9];
  388. char *errlvlshell[255];
  389.  
  390. struct parse_list far rspverbs[] =
  391. {
  392.     {4, "text"},
  393.     {4, "date"},
  394.     {4, "time"},
  395.     {4, "bink"},
  396.     {5, "mynode"},
  397.     {6, "system"},
  398.     {5, "sysop"},
  399.     {6, "yrnode"},
  400.     {7, "request"},
  401.     {6, "status"},
  402.     {5, "abort"},
  403.     {4, "exit"},
  404.     {4, "line"},
  405.     {0, ""}
  406. };
  407.  
  408. struct parse_list far config_lines[] =
  409. {
  410.     {8, "SameRing"},
  411.     {11, "NewNodeList"},
  412.     {13, "QuickNodeList"},
  413.     {10, "Answerback"},
  414.     {5, "Macro"},
  415.     {5, "Shell"},
  416.     {4, "Dial"},
  417.     {5, "Event"},
  418.     {4, "Zone"},
  419.     {6, "MaxReq"},
  420.     {8, "LogLevel"},
  421.     {4, "Baud"},
  422.     {7, "MaxPort"},
  423.     {4, "Port"},
  424.     {7, "Carrier"},
  425.     {9, "StatusLog"},
  426.     {6, "Reader"},
  427.     {9, "BossPhone"},
  428.     {7, "BossPwd"},
  429.     {8, "Protocol"},
  430.     {6, "System"},
  431.     {5, "Sysop"},
  432.     {4, "Boss"},
  433.     {5, "Point"},
  434.     {3, "Aka"},
  435.     {4, "Hold"},
  436.     {9, "DownLoads"},
  437.     {7, "NetFile"},
  438.     {4, "Init"},
  439.     {4, "Busy"},
  440.     {6, "Prefix"},
  441.     {8, "NodeList"},
  442.     {5, "Avail"},
  443.     {6, "OKFile"},
  444.     {5, "About"},
  445.     {8, "MailNote"},
  446.     {6, "Banner"},
  447.     {10, "UnAttended"},
  448.     {9, "OverWrite"},
  449.     {4, "Rev3"},
  450.     {7, "ReqOnUs"},
  451.     {8, "LockBaud"},
  452.     {7, "TimeOut"},
  453.     {5, "NoSLO"},
  454.     {9, "SlowModem"},
  455.     {11, "SmallWindow"},
  456.     {8, "NoPickup"},
  457.     {10, "NoRequests"},
  458.     {7, "NetMail"},
  459.     {6, "Suffix"},
  460.     {12, "NoFullScreen"},
  461.     {8, "AutoBaud"},
  462.     {4, "Gong"},
  463.     {9, "NoCollide"},
  464.     {8, "TBBSList"},
  465.     {8, "TaskView"},
  466.     {7, "TopView"},
  467.     {9, "ExtrnMail"},
  468.     {7, "BBSNote"},
  469.     {3, "BBS"},
  470.     {10, "ScriptPath"},
  471.     {7, "BoxType"},
  472.     {9, "MultiLink"},
  473.     {7, "Include"},
  474.     {11, "CaptureFile"},
  475.     {9, "CursorCol"},
  476.     {9, "CursorRow"},
  477.     {9, "DoingMail"},
  478.     {8, "EnterBBS"},
  479.     {10, "PrivateNet"},
  480.     {6, "Packer"},
  481.     {7, "Cleanup"},
  482.     {9, "AfterMail"},
  483.     {6, "Colors"},
  484.     {9, "JanusBaud"},
  485.     {11, "ReqTemplate"},
  486.     {10, "KnownAvail"},
  487.     {12, "KnownReqList"},
  488.     {10, "KnownAbout"},
  489.     {12, "KnownInbound"},
  490.     {11, "KnownReqLim"},
  491.     {11, "KnownReqTpl"},
  492.     {9, "ProtAvail"},
  493.     {11, "ProtReqList"},
  494.     {9, "ProtAbout"},
  495.     {11, "ProtInbound"},
  496.     {10, "ProtReqLim"},
  497.     {10, "ProtReqTpl"},
  498.     {11, "Application"},
  499.     {7, "NoZones"},
  500.     {6, "Answer"},
  501.     {9, "PollTries"},
  502.     {7, "SwapDir"},
  503.     {7, "Address"},
  504.     {10, "CurMudgeon"},
  505.     {7, "NoWaZOO"},
  506.     {11, "ScreenBlank"},
  507.     {10, "Mark_Kromm"},
  508.     {6, "Server"},
  509.     {10, "ModemTrans"},
  510.     {7, "PreDial"},
  511.     {7, "PreInit"},
  512.     {7, "DTRHigh"},
  513.     {5, "Debug"},
  514.     {8, "NoZedZap"},
  515.     {8, "NoResync"},
  516.     {9, "NoSEAlink"},
  517.     {8, "FTS-0001"},
  518.     {10, "LineUpdate"},
  519.     {7, "JanusOK"},
  520.     {8, "TermInit"},
  521.     {12, "DomainKludge"},
  522.     {5, "Snoop"},
  523.     {5, "Flags"},
  524.     {10, "TaskNumber"},
  525.     {8, "MaxBytes"},
  526.     {13, "KnownMaxBytes"},
  527.     {12, "ProtMaxBytes"},
  528.     {11, "StartBlkLen"},
  529.     {7, "MaxTime"},
  530.     {12, "KnownMaxTime"},
  531.     {11, "ProtMaxTime"},
  532.     {9, "RingTries"},
  533.     {9, "NoSharing"},
  534.     {8, "Version7"},
  535.     {9, "BlankWait"},
  536.     {6, "Serial"},
  537.     {10, "NoDietIfna"},
  538.     {8, "Version6"},
  539.     {8, "WinSlice"},
  540.     {6, "NoSize"},
  541.     {8, "ForcExit"},
  542.     {6, "Extern"},
  543.     {6, "NoEMSI"},
  544.     {10, "MyLocation"},
  545.     {7, "MyPhone"},
  546.     {11, "MyListFlags"},
  547.     {9, "MyMaxbaud"},
  548.     {9, "PickUpAll"},
  549.     {7, "FileSec"},
  550.     {8, "KnownSec"},
  551.     {7, "ProtSec"},
  552.     {8, "MaxAreas"},
  553.     {6, "Domain"},
  554.     {9, "MailSound"},
  555.     {9, "FileSound"},
  556.     {8, "BBSSound"},
  557.     {8, "EXTSound"},
  558.     {10, "StartSound"},
  559.     {8, "FaxSound"},
  560.     {8, "FaxInDir"},
  561.     {12, "ModemFailure"},
  562.     {11, "ModemIgnore"},
  563.     {12, "ModemConnect"},
  564.     {12, "ModemRinging"},
  565.     {13, "ModemIncoming"},
  566.     {8,  "ModemFax"},
  567.     {7,  "Costlog"},
  568.     {8,  "CostUnit"},
  569.     {8,  "EuroCost"},
  570.     {8,  "NoFilter"},
  571.     {6,  "BiDiOK"},
  572.     {8,  "BiDiBaud"},
  573.     {7,  "NoHydra"},
  574.     {7,  "NoJanus"},
  575.     {12, "ExtBaudRates"},
  576.     {9,  "AfterCall"},
  577.     {6,  "PktRsp"},
  578.     {10, "ExtSession"},
  579.     {7,  "FaxBaud"},
  580.     {13, "ErrLevelShell"},
  581.     {9,  "AltNumber"},
  582.     {10, "ModemRetry"},
  583.     {19, "RecentActivityLines"},
  584.     {8,  "RingWait"},
  585.     {9,  "WinFOSSIL"},
  586.     {0, ""}
  587. };
  588.  
  589. int Netmail_Session;
  590. HISTORY start_hist;
  591. int isOriginator = 0;            /* Global logical "I'm the caller"   */
  592. int got_arcmail;
  593. int got_packet;
  594. int got_mail;
  595. int got_fax;
  596. int mail_finished;
  597. int sent_mail;
  598. int made_request;                /* WaZOO file request flag */
  599. int net_problems;                /* This should be external */
  600.  
  601. ADDR remote_addr;
  602. unsigned short remote_capabilities;
  603. unsigned short my_capabilities;
  604. ADDR remote_akas[ALIAS_CNT + 1];/* List of alias addresses of remote */
  605. int num_rakas = 0;                /* How many he's using (EMSI)        */
  606. int remote_pickup = 0;            /* Does the remote want his mail ?   */
  607.  
  608. ADDR next_addr;
  609.  
  610. char *remote_password;
  611. char *BBSesc = "\rPress <Escape> to enter BBS.\r";
  612. char *noBBS = "\r\rProcessing Mail. Please hang up.\r\r";
  613. int no_pickup = 0;
  614. int pickup_all = 0;
  615. int no_WaZOO = 0;
  616. int no_WaZOO_Session = 0;
  617. int no_EMSI = 0;
  618. int no_EMSI_Session = 0;
  619.  
  620. word ExtMailMask = 0;
  621. char *ExtMailAgent = NULL;
  622.  
  623. char *request_template = "%s%s.R%02x";
  624.  
  625. char *ext_flags = "ODCH";        /* Change to whatever, and */
  626.  
  627. struct _lang_hdr *PrdctHdr;
  628. char **PrdctTbl;                /* The New Order */
  629.  
  630. struct _lang_hdr *AnsiHdr;
  631. char *AnsiTbl;
  632.  
  633. #ifdef HAVE_HYDRA
  634. ULONG hydra_options  = 0x0L;
  635. long hydra_txwindow = 0L;
  636. long hydra_rxwindow = 0L;
  637. #endif
  638.  
  639. int no_hydra = 0;
  640. int no_janus = 0;
  641. int no_zapzed = 0;
  642. int no_dietifna = 0;
  643. int on_our_nickel = 0;
  644.  
  645. #ifdef _WIN32
  646. int use_winfossil = 0;
  647. #endif
  648.  
  649. char fossil_buffer[128];
  650. char out_buffer[128];
  651. char *fossil_fetch_pointer = fossil_buffer;
  652. char *out_send_pointer = out_buffer;
  653. int fossil_count = 0;
  654. int out_count = 0;
  655. int old_fossil = 1;
  656. int rev3 = 0;
  657. char ctrlc_ctr;
  658. FOSINFO fossil_info =
  659. {
  660.     0, 0, 0, 0L, 0, 0, 0, 0, 0, 0, 0
  661. };
  662.  
  663. char no_requests = 0;
  664. int who_is_he = 0;
  665.  
  666. int curmudgeon = 0;                /* 1 = Randy Bush           */
  667. int small_window = 0;
  668. int no_overdrive = 0;
  669. int no_resync = 0;
  670. int no_sealink = 0;
  671. int immed_update = 0;
  672.  
  673. unsigned long janus_baud = 0;
  674.  
  675. ADDR called_addr;
  676. int mail_only = 0;
  677. int caller;
  678. int more_mail;
  679. int doing_poll;
  680.  
  681. char far BBSwelcome[WELCOME_LEN + 1];    /* was 1024 */
  682. char *aftermail = NULL;
  683.  
  684. struct FILEINFO dta_str = {0};
  685. int slowmodem = 0;
  686.  
  687. PN_TRNS *pn_head = NULL;
  688. ANUMS    *anum_head = NULL;
  689. MDM_TRNS *mm_head = NULL;
  690.  
  691. unsigned have_windows = 0;
  692. unsigned have_mos = 0;
  693. unsigned have_dv = 0;
  694. unsigned have_ddos = 0;
  695. unsigned have_tv = 0;
  696. unsigned have_ml = 0;
  697. unsigned winslice = 0;
  698. unsigned long lock_baud = 0;
  699.  
  700. /* Ideally we'd merge the ARQ and MNP stuff and have a new
  701.    config verb that defined the strings and one that said lock
  702.    on ARQ */
  703.  
  704. int ARQ_lock = 0;                /* If 1, baudrate is locked  */
  705. int ARQs = 0;                    /* Number of ARQ strings     */
  706. char *ARQ[16];                    /* Pointers to ARQ strings   */
  707.  
  708. int cMNP = 0;                    /* Number of MNP strings     */
  709. char *pchMNP[16];                /* Pointers to MNP strings   */
  710.  
  711. char e_input[255];
  712.  
  713. char *IDUNNO_msg = " ???";
  714. char *local_CEOL = "\033[K";
  715.  
  716. char *wkday[] =
  717. {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
  718.  
  719. char *nodelist_name = NULL;        /* Name of our nodelist      */
  720. char *nodelist_base = NULL;        /* Name of current nodelist  */
  721. char *max_areadat = NULL;
  722.  
  723. #ifdef V5_LIST
  724. int newnodelist = 0;            /* if 1, use new nodelist.   */
  725. #else
  726. int newnodelist = 1;            /* if 1, use new nodelist.   */
  727. #endif
  728. int version7 = 0;                /* Support new V7 nodelist   */
  729.  
  730. int autobaud = 0;                    /* Use highest baudrate when calling out */
  731.  
  732. unsigned short found_zone = 0;/* What zone found node is in*/
  733. unsigned short found_net = 0;    /* What net found node is in */
  734. struct _newnode newnodedes;    /* structure in new list     */
  735.  
  736. char far *node_index = (char far *) NULL;    /* pointer to node array     */
  737.  
  738. HISTORY hist;
  739. BINK_EVENT far *e_ptrs;
  740. int requests_ok = 1;
  741. int num_events = 0;
  742. int cur_event = -1;
  743. int next_event = 0;
  744. int got_sched = 0;
  745. int noforce = 0;
  746. int no_zones = 0;
  747. int max_connects = 3;
  748. int max_noconnects = 10000;
  749. int server_mode = 0;
  750. int forcexit = 0;                /* force exit errorlevel */
  751. char *packer;
  752. char *cleanup;
  753. char *answerback;
  754.  
  755. time_t etm = (time_t) 0L;
  756. long file_length = 0L;
  757.  
  758. long TX_FileSize;
  759. long TX_StTime;
  760. int TX_OldETA;
  761.  
  762. long RX_FileSize;
  763. long RX_StTime;
  764. int RX_OldETA;
  765.  
  766. char *XFER_str = " pos=        , len=    , ETA=     min.";
  767. char *script_path;                /* Where the script files
  768.                                                   * live */
  769.  
  770. char Rxhdr[4];                    /* Received header           */
  771. char Txhdr[4];                    /* Transmitted header        */
  772.  
  773. #ifndef GENERIC
  774. long *RXlong = (long *) &Rxhdr[0];
  775. long *TXlong = (long *) &Txhdr[0];
  776. #endif
  777.  
  778. long Rxpos;                        /* Received file position    */
  779. int Txfcs32;                    /* TRUE means send binary
  780.                                                   * frames with 32 bit FCS    */
  781. int Crc32t;                        /* Display flag indicating
  782.                                                   * 32 bit CRC being sent */
  783. int Crc32;                        /* Display flag indicating
  784.                                                   * 32 bit CRC being received */
  785. int Znulls;                        /* # of nulls to send at
  786.                                                   * beginning of ZDATA hdr     */
  787.  
  788. int Rxtimeout;                    /* Tenths of seconds to wait
  789.                                                   * for something          */
  790. int Rxframeind;                    /* ZBIN ZBIN32,ZHEX type of
  791.                                                   * frame received */
  792.  
  793. char *Filename;                    /* Name of the file being
  794.                                                   * up/downloaded             */
  795.  
  796. word z_size = 0;
  797.  
  798. byte Resume_WaZOO;                /* Flags resumption of
  799.                                                   * aborted WaZOO xfer  */
  800. char Resume_name[13];            /* "Real" name of file being
  801.                                                   * received      */
  802. char Resume_info[48];            /* File size&time info for
  803.                                                   * rx file         */
  804. char Abortlog_name[PATHLEN];    /* Path of WaZOO aborted
  805.                                                   * xfer log      */
  806.  
  807. nfunc nodefunc = opusfind;        /* Nodelist function to use */
  808. ufunc userfunc = fidouser;        /* Userlist function to use */
  809.  
  810. SB_COLORS colors = {7, 7, 7, 7, 7, 7, 112, 7};
  811.  
  812. #ifdef DOS16
  813. struct vfossil_hooks vfossil_funcs;
  814. #endif
  815.  
  816. int vfossil_installed = 0;
  817. VIOMODEINFO vfos_mode;
  818. char far blanks[264];
  819.  
  820. char *logptr;
  821.  
  822. MAILP mail_top;
  823. MAILP next_mail;
  824. long next_rescan = 0L;
  825. long waitfor_line = 0L;            /* Used to limit collision*/
  826.  
  827. /* logic                  */
  828.  
  829. J_TYPESP j_top;
  830. J_TYPESP j_next;
  831. int janus_OK;
  832. char saved_response[80];
  833. char mdm_reliable[80];
  834.  
  835. /* First, the polynomial itself and its table of feedback terms.  The  */
  836. /* polynomial is                                                       */
  837. /* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */
  838. /* Note that we take it "backwards" and put the highest-order term in  */
  839. /* the lowest-order bit.  The X^32 term is "implied"; the LSB is the   */
  840. /* X^31 term, etc.  The X^0 term (usually shown as "+1") results in    */
  841. /* the MSB being 1.                                                    */
  842.  
  843. /* Note that the usual hardware shift register implementation, which   */
  844. /* is what we're using (we're merely optimizing it by doing eight-bit  */
  845. /* chunks at a time) shifts bits into the lowest-order term.  In our   */
  846. /* implementation, that means shifting towards the right.  Why do we   */
  847. /* do it this way?  Because the calculated CRC must be transmitted in  */
  848. /* order from highest-order term to lowest-order term.  UARTs transmit */
  849. /* characters in order from LSB to MSB.  By storing the CRC this way,  */
  850. /* we hand it to the UART in the order low-byte to high-byte; the UART */
  851. /* sends each low-bit to hight-bit; and the result is transmission bit */
  852. /* by bit from highest- to lowest-order term without requiring any bit */
  853. /* shuffling on our part.  Reception works similarly.                  */
  854.  
  855. /* The feedback terms table consists of 256, 32-bit entries.  Notes:   */
  856. /*                                                                     */
  857. /*     The table can be generated at runtime if desired; code to do so */
  858. /*     is shown later.  It might not be obvious, but the feedback      */
  859. /*     terms simply represent the results of eight shift/xor opera-    */
  860. /*     tions for all combinations of data and CRC register values.     */
  861. /*                                                                     */
  862. /*     The values must be right-shifted by eight bits by the "updcrc"  */
  863. /*     logic; the shift must be unsigned (bring in zeroes).  On some   */
  864. /*     hardware you could probably optimize the shift in assembler by  */
  865. /*     using byte-swap instructions.                                   */
  866.  
  867. unsigned long far cr3tab[] =
  868. {                                /* CRC polynomial 0xedb88320 */
  869.     0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
  870.     0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
  871.     0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
  872.     0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
  873.     0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
  874.     0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
  875.     0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
  876.     0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
  877.     0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
  878.     0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
  879.     0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
  880.     0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
  881.     0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
  882.     0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
  883.     0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
  884.     0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
  885.     0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
  886.     0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
  887.     0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
  888.     0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
  889.     0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
  890.     0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
  891.     0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
  892.     0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
  893.     0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
  894.     0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
  895.     0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
  896.     0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
  897.     0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
  898.     0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
  899.     0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
  900.     0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
  901. };
  902.  
  903. /*
  904.  *
  905.  * -rev 04-16-87  (abbreviated)
  906.  *  The CRC-16 routines used by XMODEM, YMODEM, and ZMODEM
  907.  *  are also in this file, a fast table driven macro version
  908.  */
  909.  
  910. /* crctab calculated by Mark G. Mendel, Network Systems Corporation */
  911. unsigned short far crctab[256] =
  912. {
  913.     0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
  914.     0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
  915.     0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
  916.     0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
  917.     0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
  918.     0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
  919.     0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
  920.     0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
  921.     0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
  922.     0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
  923.     0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
  924.     0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
  925.     0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
  926.     0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
  927.     0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
  928.     0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
  929.     0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
  930.     0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
  931.     0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
  932.     0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
  933.     0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
  934.     0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
  935.     0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
  936.     0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
  937.     0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
  938.     0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
  939.     0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
  940.     0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
  941.     0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
  942.     0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
  943.     0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
  944.     0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
  945. };
  946.  
  947. short SB_ROWS;
  948. short SB_COLS;
  949. char *stat_str = "%c %02i:%02i:%02i %         ";
  950. char *script_line = "Script Line %03d: %         ";
  951. int need_update = 0;
  952. char *ver_stuff = "Compiled on " __DATE__ " at " __TIME__ "\r\n\r\n";
  953. char *BadChars = "\026\021\b\377\376\375\374";
  954. int pktrsp = 0;                    /* MB 93-12-12  PKTRSP */
  955.  
  956.